<?php

/*
 * CopyRight  : (C)2012-2099 HaoTeam Inc.
 * Document   : ArticleCategoryValidate.php
 * Created on : 2021-1-28 11:23:21
 * Author     : Tiger <1192851302@qq.com>
 * Description: This is NOT a freeware, use is subject to license terms.
 *              这即使是一个免费软件,使用时也请遵守许可证条款,得到当时人书面许可.
 *              未经书面许可,不得翻版,翻版必究;版权归属 HaoTeam Inc;
 */

namespace haoteam\http\validates;

use think\Validate;

/**
 * 内容类别验证器
 * Class ArticleCategoryValidate
 * Tiger <1192851302@qq.com> 2021-1-28 11:23:21
 */
class ArticleCategoryValidate extends Validate {

    protected $rule = [
        'id' => 'require|number',
        'pid' => 'require|number',
        'name' => 'require|chsAlpha|max:6',
        'ids' => 'require|array',
        'field' => 'require',
        'value' => 'require'
    ];
    protected $message = [
        'id.require' => 'ID不能为空',
        'ids.require' => 'ID不能为空',
        'ids.array' => 'ID格式不对',
        'id.number' => 'ID格式不对',
        'pid.require' => '上级类别不能为空',
        'pid.number' => '上级类别式不对',
        'name.require' => '类别名称不能为空',
        'name.chsAlpha' => '类别名称只能是中文汉字',
        'name.max' => '类别名称最多6个汉字'
    ];
    protected $scene = [
        'create' => ['pid', 'name'],
        'update' => ['id', 'pid', 'name'],
        'save' => ['ids', 'field', 'value']
    ];

}
